package edu.snake.implement.model.arena;

import edu.snake.core.model.arena.Position;

public class PositionFactory {
    public static Position getNewPosition(int width, int height) {
        return new PositionImpl(width, height);
    }



    public static Position getNewPosition(Position position, Direction direction) {
        switch (direction) {
            case LEFT:
                return getNewPosition(position.getWidth() - 1, position.getHeight());
            case DOWN:
                return getNewPosition(position.getWidth(), position.getHeight() + 1);
            case RIGHT:
                return getNewPosition(position.getWidth() + 1, position.getHeight());
            case UP:
                return getNewPosition(position.getWidth(), position.getHeight() - 1);
        }
        throw new RuntimeException("Method was not able to create the Position object.");
    }
}